package suncertify.db;

/**
 * A type of <code>Exception</code> indicating there is already a record in the DB 
 * with the same key when trying to create a record.  With the current requirements, 
 * this Exception will never be thrown because the database doesn't contain implementation
 * for creating records.
 * @author Paul Wilhelm
 *
 */
public class DuplicateKeyException extends Exception{
    

	private static final long serialVersionUID = 1981;			//UID that is verified during deserialization
	private String message;										//The default message to be displayed when Exception is thrown.
	
	/**
	 * Regular Constructor.  Passes a default String message to the String constructor.
	 */
    public DuplicateKeyException(){
        this("A record with this key already exists");
    }
    
    /**
     * String constructor that takes a customizable String to set as the message
     * of the Exception.
     * @param message - The message to be displayed when the Exception is thrown
     */
    public DuplicateKeyException(String message){
        this.message = message;
    }
    
    /**
     * Gets the message of the <code>DuplicateKeyException</code>.
     * @return The Message that the Exception should display
     */
    public String getMessage(){
    	return message;
    }

}
